import request from '@/utils/request'

// 客户导入
export function customersImport(data) {
  return request({
    url: `customers/import`,
    method: 'post',
    data
  })
}

// 查询客户列表
export function getCustomersList({page, pageSize, query}) {
  return request({
    url: `customers/${page}/${pageSize}`,
    method: 'get',
    params: query
  })
}

// 新增客户
export function addCustomer(data) {
  return request({
    url: `customers`,
    method: 'post',
    data
  })
}

// 编辑客户
export function editCustomer(data) {
  return request({
    url: `customers/${data.customerId}`,
    method: 'post',
    data
  })
}

// 删除客户
export function delCustomer(id) {
  return request({
    url: `customers/${id}`,
    method: 'delete'
  })
}

// 获取客户设备列表
export function getDevideList(id) {
  return request({
    url: `customers/device-list/${id}`,
    method: 'get'
  })
}

// 采集终端号选择列表
export function boxSelectList(id) {
  return request({
    url: `customers/box-select-list/${id}`,
    method: 'get'
  })
}

// 运行时长统计
export function getWorkingTime(boxNo) {
  return request({
    url: `customers/working-time?boxNo=${boxNo}`,
    method: 'get'
  })
}

// 运动轨迹
export function getLocationMoveList(imei) {
  return request({
    url: `customers/move-location?&imei=${imei}`,
    method: 'get'
  })
}

// 删除设备
export function delDevice(id) {
  return request({
    url: `customers/device/${id}`,
    method: 'delete'
  })
}

// 新增设备
export function addDevice(data) {
  return request({
    url: `customers/device`,
    method: 'post',
    data
  })
}

// 编辑设备
export function editDevice(data) {
  return request({
    url: `customers/device/${data.deviceId}`,
    method: 'put',
    data
  })
}

// 定位器号选择列表
export function imeiSelectList(id) {
  return request({
    url: `customers/imei-select-list/${id}`,
    method: 'get'
  })
}

// 最新定位
export function latestLocation(imei) {
  return request({
    url: `customers/latest-location?imei=${imei}`,
    method: 'get'
  })
}